

public class Node {
	Node left;
	Node right;
	boolean visited;
	int value;
	
	public Node(int val) { value=val;	visited=false;}	
	public Node getLeft() { return left; }	
	public Node getRight() { return right; }	
	public int getValue() { return value; }	
	public boolean getVisited() { return visited; }
	public void setVisited(boolean nieuw) { visited=nieuw; }
	
	public void addChild(int newNode) {
		if (newNode <= value) {
			if (left == null)
				left = new Node(newNode);
			else
				left.addChild(newNode);
		}
		else if (newNode > value) {
			if (right == null)
				right = new Node(newNode);
			else 
				right.addChild(newNode);
		}		
	}
	
}
